The present invention relates generally to computing systems, and more particularly, to techniques for processing events for concurrent tasks in a virtual machine.
One of the goals of high-level computer programming languages is to provide a portable programming environment. In such an environment, computer programs may easily be ported to another computer platform. High-level languages such as “C” provide a level of abstraction from the underlying computer architecture and their success is well evidenced from the fact that most computer applications are now written in a high level language.
Portability has been taken to new heights with the advent of the World Wide Web (“the Web”) as an interface protocol for the Internet. The World Wide Web allows communication between diverse computer platforms through a graphical interface. Computers communicating over the Web are able to download and execute small applications called applets. Given that applets may be executed on a diverse assortment of computer platforms, the applets are typically executed by a Java™ virtual machine. In general, a virtual machine is an abstract computing machine that is implemented over specific hardware and/or software. The virtual machine can support platform applications for the specific hardware and/or software. Given that the Java™ virtual machine is more prevalent, the Java computing environment will be discussed further.
Recently, the Java programming environment has become quite popular. The Java programming language is a language that is designed to be portable enough to be executed on a wide range of computers ranging from small devices (e.g., pagers, cell phones and smart cards) up to supercomputers. Computer programs written in the Java programming language (and other languages) may be compiled into Java Bytecode instructions that are suitable for execution by a Java virtual machine implementation. The Java virtual machine is commonly implemented in software by means of an interpreter for the Java virtual machine instruction set but, in general, may be software, hardware, or both. A particular Java virtual machine implementation and corresponding support libraries together constitute a Java runtime environment.
Computer programs in the Java programming language are arranged in one or more classes or interfaces (referred to herein jointly as classes or class files). Such programs are generally platform, i.e., hardware and operating system, independent. As such, these computer programs may be executed without modification on any computer that is able to run an implementation of the Java runtime environment.
Object-oriented classes written in the Java programming language are compiled to a particular binary format called the “class file format.” The class file includes various components associated with a single class. These components can be, for example, methods and/or interfaces associated with the class. In addition, the class file format can include a significant amount of ancillary information that is associated with the class. The class file format (as well as the general operation of the Java virtual machine) is described in some detail in The Java Virtual Machine Specification, Second Edition, by Tim Lindholm and Frank Yellin, ISBN 0-201-43294-3, April 1999, which is hereby incorporated herein by reference.
FIG. 1A shows a progression of a simple piece of a Java source code 101 through execution by an interpreter, the Java virtual machine. The Java source code 101 includes the classic Hello World program written in Java. The source code is then input into a Bytecode compiler 103 that compiles the source code into Bytecodes. The Bytecodes are virtual machine instructions as they will be executed by a software emulated computer. Typically, virtual machine instructions are generic (i.e., not designed for any specific microprocessor or computer architecture) but this is not required. The Bytecode compiler outputs a Java class file 105 that includes the Bytecodes for the Java program. The Java class file is input into a Java virtual machine 107. The Java virtual machine is an interpreter that decodes and executes the Bytecodes in the Java class file. The Java virtual machine is an interpreter, but is commonly referred to as a virtual machine as it emulates a microprocessor or computer architecture in software (e.g., the microprocessor or computer architecture may not exist in hardware).
Virtual machines are highly useful. However, as will be discussed below, conventional virtual machines do not provide a multi-tasking environment in a manner that would allow a user to concurrently perform some tasks. These tasks, for example, include interactive tasks (e.g., application programs) that receive input from the user or another source.
In a multi-tasking computing environment, a task can be referred to as a single computing unit that typically performs a task. The computing unit can, for example, be represented by a set of programming instructions (e.g., high-level programming instruction written in C, C++, or Java). On the other hand, a task may also be an entire application program (or applet). By way of example, a task may be a calculator, a music player, a video player, or an interactive game. The user can initiate and use each of these tasks to form a function or computing task.
In any case, a computing system that supports multi-tasking allows tasks to run concurrently. Concurrent tasks typically take turns to execute and/or share the resources of the computer system. However, from the user's perspective multiple tasks can be performed concurrently. By way of example, a user can use a calculator application and a music player concurrently. This allows the user to do calculations while listening to the music. Conventional virtual machines, however, do not provide a multi-tasking environment in a manner that would allow a user to concurrently use tasks that are interactive. This means that the user of a conventional virtual machine cannot effectively interact with two concurrent tasks.
In view of the foregoing, techniques for multi-tasking in a virtual machine are needed.